//
//  TTGlobalStatus.m
//  ExhibitionHall
//
//  Created by 王洋 on 2019/6/27.
//  Copyright © 2019 王洋. All rights reserved.
//

#import "TTGlobalStatus.h"

@interface TTGlobalStatus ()

@end

@implementation TTGlobalStatus

+ (TTGlobalStatus *)sharedStatus {
    static TTGlobalStatus *shareInstance;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken,^{
        
        shareInstance = [TTGlobalStatus new];
    });
    return shareInstance;
}

- (NSString *)goodsDetailGuideStatus {
    
    NSString *status = [self.globalStatusDefault valueForKey:@"goods_detail_guide_status"];
    if (!status) {
        status = @"0";
    }
    
    return status;
}

- (NSString *)startGuideStatus {
    
    NSString *status = [self.globalStatusDefault valueForKey:@"start_guide_status"];
    if (!status) {
        status = @"0";
    }
    
    return status;
}

-(NSUserDefaults *)globalStatusDefault {
    if (!_globalStatusDefault) {
        _globalStatusDefault = [NSUserDefaults standardUserDefaults];
    }
    return _globalStatusDefault;
}

- (void)refreshTime {
    
    NSMutableDictionary *dic = @{}.mutableCopy;
    NSString *url = [NSString stringWithFormat:@"%@%@",TT_Global_Api_Domain,TT_INDEX_MESSAGE];
    [TTHttpManager postRequestWithUrl:url TimeOut:10 PostData:dic FinishBlock:^(id  _Nonnull data) {
        
            if ([data isKindOfClass:[NSDictionary class]]) {
                
                NSString * code = [data valueForKey:@"code"];
                if ([code isEqualToString:@"200"]) {
                    NSDictionary *resultDic = [data valueForKey:@"data"];
                    if ([resultDic isKindOfClass:[NSDictionary class]]) {

                    
                } else {
                    
                }
                
            } else {
                
            }
        }
        
    } FailedBlock:^(NSError * _Nonnull error) {
        
    }];
    
}
@end
